package fr.umlv.android.caveAvin.sqlite;

import java.io.Serializable;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

public class MyProjectBDD implements Serializable {
	
	private static final long serialVersionUID = 1L;
	private static final int VERSION_BDD = 1;
	private static final String NOM_BDD = "caveAvins.db";
	
	
	protected static SQLiteDatabase bdd;
	 
	private MaBaseSQLite maBaseSQLite;
	
	public MyProjectBDD(Context context){
		//On créer la BDD et sa table
		maBaseSQLite = new MaBaseSQLite(context, NOM_BDD, null, VERSION_BDD);
	}
 
	public void open(){
		//on ouvre la BDD en écriture
		bdd = maBaseSQLite.getWritableDatabase();
		maBaseSQLite.onUpgrade(bdd,0,0);
	}
 
	public void close(){
		//on ferme l'accès à la BDD
		bdd.close();
	}
 
	public SQLiteDatabase getBDD(){
		return bdd;
	}
}
